//
//  ShopCartSuitsCell.m
//  TryShopping
//
//  Created by panquanReabam.com on 16/10/21.
//  Copyright © 2016年 RuiBen. All rights reserved.
//

#import "ShopCartSuitsCell.h"

@interface ShopCartSuitsCell()

@end
@implementation ShopCartSuitsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //        [self createView];
        //        [self setViewAutoLayout];
    }
    return self;
}


-(void)setGetAddBuyGoodsModel:(GetAddBuyGoodsModel *)GetAddBuyGoodsModel{
    
    
    NSLog(@"itemIditemId%@",GetAddBuyGoodsModel.itemId);
    
    self.productImageView=[[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 70, 70)];
    _productImageView.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
    _productImageView.layer.borderWidth= 0.5f;
    [_productImageView setImageWithURL:[NSURL URLWithString:GetAddBuyGoodsModel.imageUrl] placeholderImage:[UIImage imageNamed:@"zhengfangxing"]];
    [self addSubview:_productImageView];
    _productNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(95, 15, ScreenWidth-116, 13)];
    [_productNameLabel setText:GetAddBuyGoodsModel.itemName];
    _productNameLabel.font=[UIFont systemFontOfSize:13];
    _productNameLabel.textColor=[UIColor colorWithRed:51.0/255.0f green:51.0/255.0f  blue:51.0/255.0f  alpha:1.0];
    [self addSubview:_productNameLabel];
    
  
    if (  [[Global getJudgeTheErrorStr:GetAddBuyGoodsModel.specName]isEqualToString:@""]||GetAddBuyGoodsModel.specName==NULL ) {
        
    }else{
        
        
        NSString *s1 =[NSString stringWithFormat:@"%@",GetAddBuyGoodsModel.specName];
        UIFont *font1 = [UIFont systemFontOfSize:14];
        CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
        CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
        
        _productSpecNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(95, 35, labelsize1.width+10, 25)];
        [_productSpecNameLabel setText:[NSString stringWithFormat:@"%@",GetAddBuyGoodsModel.specName ]];
        _productSpecNameLabel.font=[UIFont systemFontOfSize:12];
        _productSpecNameLabel.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
        _productSpecNameLabel.layer.borderWidth= 0.5f;
        _productSpecNameLabel.textAlignment=NSTextAlignmentCenter;
        _productSpecNameLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
        [self addSubview:_productSpecNameLabel];
    }
    _productPriceLabel=[[UILabel alloc] initWithFrame:CGRectMake(95, 73.5, 200, 12)];
    
    
    [_productPriceLabel setText:[NSString stringWithFormat:@"¥ %0.02f",[GetAddBuyGoodsModel.salePrice floatValue]]];
    
    
    _productPriceLabel.font=[UIFont systemFontOfSize:12];
    _productPriceLabel.textColor=[UIColor colorWithRed:102.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
    [self addSubview:_productPriceLabel];
    _productInvLabel=[[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth-125, 73.5, 110, 15)];
    [_productInvLabel setText:[NSString stringWithFormat:@"x %d",[GetAddBuyGoodsModel.quantity intValue]]];
    _productInvLabel.font=[UIFont systemFontOfSize:13];
    _productInvLabel.textColor=[UIColor colorWithRed:109.0/255.0f green:102.0/255.0f  blue:102.0/255.0f  alpha:1.0];
    NSString *str=[NSString stringWithFormat:@"x %d",[GetAddBuyGoodsModel.quantity intValue]];
    NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:str];
    [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0] range:NSMakeRange(0, 2)];
    
    _productInvLabel.attributedText=attriString;
    _productInvLabel.textAlignment=NSTextAlignmentRight;
    [self addSubview:_productInvLabel];
    self.lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 100-0.45, ScreenWidth-20, 0.45)];
    [self.lineLabel setBackgroundColor:qianhuiColor];
    [self addSubview:self.lineLabel];
    
    
}

-(void)chooseBtn:(UIButton*)sender{
    
    
    
}


@end
